Skip to content

TASK-214337 debug code#13

Open
balupillai wants to merge 6 commits intomainfrom
TASK-214337
Open

TASK-214337 debug code#13
balupillai wants to merge 6 commits intomainfrom
TASK-214337

Conversation

@balupillai
Copy link
Contributor

@balupillai balupillai commented Mar 12, 2026

Note

Medium Risk
Adds frequent heap validation and abort() on suspected corruption during GC, thread inheritance, and global tracing; this can impact performance and may terminate processes if the checks false-positive or trigger in production.

Overview
Adds aggressive heap-integrity validation to GC-critical code paths. Introduces validate_heap_objects() (plus basic bad-pointer/type/freed-bit checks) and calls it at multiple stages of local_collection(), before/after heap object transfer in luaC_inherit_thread(), and at the start of trace_heap().

Also moves deferred finalization (finalize_deferred()) to run before unblocking the collector during local GC, with additional validation checkpoints before/after reclaiming and freeing deferred objects.

Written by Cursor Bugbot for commit 53b84ba. This will update automatically on new commits. Configure here.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds new heap integrity validation to detect GC heap corruption and abort early, integrated into key GC lifecycle points and global tracing to surface memory/list corruption issues closer to their source.

Changes:

  • Introduces validate_heap_objects(lua_State *L, const char *where) to walk L->heap->objects and validate node pointers/type/ownership, aborting on failure.
  • Calls this validation before/after heap transfer in luaC_inherit_thread() and at multiple stages of local_collection().
  • Adds basic corruption checks inside trace_heap() during global tracing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants